﻿using System;
using System.Collections.Generic;
using System.Text;

using System.Data;

namespace Duson.DAOSQLServer.Salary
{
    using Duson.DAOSQLServer;
    using DusonFramework.DataAccess.Paging;

    public class SalaryDAL : ISalary
    {
        public DataSet GetDataByPage(string table, string fields, string filter, string sortField, int sortType, int pageIndex, int pageSize)
        {
            SQLServerProvider.Instance.PagingMethod = new Paging_Max();

            string sql = SQLServerProvider.Instance.GetPagingSQL(table, fields, filter, sortField, sortType, pageIndex, pageSize);
            //string sql = SQLServerProvider.Instance.GetPagingSQL(table, "SalaryID", fields, filter, sortField, pageIndex, pageSize);
            return SQLServerProvider.Instance.ExecuteDataset(sql);
        }

        public int GetCount()
        {
            //string str;
            //for (int i = 0; i < 1000000; i++)
            //{
            //    str = string.Format("insert into Salary values('{0}', {1}, {2}, {3})", "k",i,2008, 8);
            //    sqlHelper.ExecuteNonQuery(str);
            //}

            string sql = "select count(1) from Salary";
            return (int)SQLServerProvider.Instance.ExecuteScalar(sql);
        }
    }
}
